package com.example.movie_control;
import java.time.LocalDateTime;

public abstract class User {
    private String userId;
    private String username;
    private String password;
    private String userType;
    // 新增：需求要求的用户信息
    private LocalDateTime registerTime; // 注册时间
    private String phone; // 手机号
    private boolean isFirstLogin; // 用于密码重置后强制修改密码

    // 构造器新增注册时间（默认当前时间）和初始登录状态
    public User(String userId, String username, String password, String userType, String phone) {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.userType = userType;
        this.registerTime = LocalDateTime.now(); // 注册时间默认为创建时
        this.phone = phone;
        this.isFirstLogin = password.equals("123456"); // 初始密码为123456时需要强制修改
    }

    // 抽象方法：密码修改（所有用户需实现）
    public abstract void changePassword(String newPassword);

    public abstract void showMenu(CinemaSystem system);

    // Getter & Setter（补充新增属性）
    public LocalDateTime getRegisterTime() { return registerTime; }
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }
    public boolean isFirstLogin() { return isFirstLogin; }
    public void setFirstLogin(boolean firstLogin) { isFirstLogin = firstLogin; }

    // 原有Getter & Setter保留
    public String getUserId() { return userId; }
    public void setUserId(String userId) { this.userId = userId; }
    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }
    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }
    public String getUserType() { return userType; }
    public void setUserType(String userType) { this.userType = userType; }
}